package com.qdu.service.impl;

import com.qdu.entity.Collectioninfo;
import com.qdu.mapper.CollectioninfoMapper;
import com.qdu.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CollectionServiceImpl implements CollectionService {

    @Autowired
    private CollectioninfoMapper collectionMapper;


    @Override
    public void deleteCollection(String uid, String hid) {
        collectionMapper.delete(uid, hid);
    }

    @Override
    public void addCollection(Collectioninfo collection) {
        collectionMapper.insert(collection);
    }

    @Transactional(readOnly = true)
    @Override
    public List<Collectioninfo> getCollectionByUid(String uid) {
        return collectionMapper.selectByUid(uid);
    }

    @Transactional(readOnly = true)
    @Override
    public List<Collectioninfo> getCollectionByHid(String hid) {
        return collectionMapper.selectByHid(hid);
    }
}
